-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow casting a Mixed column into a concrete type #6777
Conversation
6296d34
to
3b6fcd2
Compare
9eb8c12
to
1c8551d
Compare
1c8551d
to
5938150
Compare
failedConversionsCount++; | ||
} | ||
|
||
public int getFailedConversionsCount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way for the user to know which values failed to convert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, not directly.
They are replaced with Nothing
in the resulting table (although there can be existing Nothing values in there, so it is not unambiguous).
Do you think there should be? I was afraid that the error message may get too long.
But maybe we can gather the first 3... or 10? values that failed to convert and display these. I guess that might be helpful. I can add it. Shall I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think a decent limit would be? IMO 3 sounds good as it shows a few examples. Anything more will make the error message too long anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure; a few might be useful, because that might be enough to fix the problems. On the other hand, the user might have to iterate many times to find all the errors, if there are a lot of problems. And I would hope that at some point we have a way to implement this that doesn't require that we re-implement it for every Column method. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now, until we have a more general plan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I would hope that at some point we have a way to implement this that doesn't require that we re-implement it for every Column method. :)
I think error handling is very usage-specific, so there is no one-fits-all solution.
In fact, I'm leaning towards creating tailored ones for each method (group), as I first attempted to create a generic Problem_Builder
but it turns out it gets unnecessarily complex if we try to solve all kinds of scenarios using one tool.
if setup.test_selection.fixed_length_text_columns then | ||
c3_2 = t2.cast "super-mix" (Value_Type.Char size=2) . at "super-mix" | ||
c3_2.value_type . should_equal (Value_Type.Char size=2) | ||
c3.to_vector . should_equal ["1.", "2.", "3", "-4", "2.", "X", "20", "20", "12", "{{", "Tr", Nothing, "Tr"] | ||
w3_2 = Problems.expect_warning Conversion_Failure c3_2 | ||
w3_2.affected_rows_count . should_equal 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if the 'trimming' of string representations should be noted as Conversion_Failure
or should it get some separate error type? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(my motivation is that we could get a bit clearer error message for this case)
Maybe we should add a second variant to Conversion_Failure
?
type Conversion_Failure
Unfit_For_Target_Type ... # <- existing one
Text_Representation_Too_long # <- for text trimming case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should report a problem -- it's not like other methods, where the user is explicitly requesting trimming/truncation, so it might be a surprise and hidden data loss is bad. Text_Representation_Too_long is a good error to know about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is reported (unless text->text in which case trimming is expected).
I'm mostly wondering if we should have a separate error type for this case or a single error for all conversion issues.
I guess the 1 error with 2 constructors may be a decent compromise.
Radosław Waśko reports a new STANDUP for yesterday (2023-05-24): Progress: Catching up after timeoff. Updating my env after GraalVM upgrade. Reviews. Meeting about imports/exports. Finished Mixed casts implementation and prepared the PR. It should be finished by 2023-05-26. Next Day: Next day I will be working on the #6410 task. Catch up with bookclubs. Get the Mixed types PR merged. Start work on add_row_numbers. |
31a15d9
to
24924f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good a couple of nit comments.
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Column.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Outdated
Show resolved
Hide resolved
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Outdated
Show resolved
Hide resolved
std-bits/table/src/main/java/org/enso/table/data/column/builder/object/NumericBuilder.java
Outdated
Show resolved
Hide resolved
std-bits/table/src/main/java/org/enso/table/data/column/builder/object/NumericBuilder.java
Outdated
Show resolved
Hide resolved
...table/src/main/java/org/enso/table/data/column/operation/cast/ToBooleanStorageConverter.java
Outdated
Show resolved
Hide resolved
...ts/table/src/main/java/org/enso/table/data/column/operation/cast/ToDateStorageConverter.java
Outdated
Show resolved
Hide resolved
...ts/table/src/main/java/org/enso/table/data/column/operation/cast/ToDateStorageConverter.java
Outdated
Show resolved
Hide resolved
24924f3
to
5e4e87d
Compare
…nclude example values.
5e4e87d
to
c7ca8e7
Compare
* develop: Allow casting a Mixed column into a concrete type (#6777) Stop graph editing when in full-screen visualization mode (#6844) Handle `show-dashboard` event (#6837) Fix some dashboard issues (#6668) Fix JWT leak (#6815) Fix "set username" screen (#6824) Fallback to opened date when ordering projects (#6814) Various test improvements to increase coverage and speed things up (#6820) do not activate nested dropdowns together (#6830) Clearly select single specialization with enum dispatch pattern (#6819) Prevent incorrect application of list widget on incompatible expressions (#6771)
…le-6756-6804 * develop: (22 commits) Coalesce graph editor view invalidations (#6786) Append warnings extracted before tail call execution (#6849) Detect and override hooks of the same kind (#6842) Dynamic app resampling and better performance measurements. (#6595) Show spinner when opening/creating a project, take #2 (#6827) Infrastructure for testing inter project imports and exports (#6840) Only initialise visualisation chooser if it is used. (#6758) Allow casting a Mixed column into a concrete type (#6777) Stop graph editing when in full-screen visualization mode (#6844) Handle `show-dashboard` event (#6837) Fix some dashboard issues (#6668) Fix JWT leak (#6815) Fix "set username" screen (#6824) Fallback to opened date when ordering projects (#6814) Various test improvements to increase coverage and speed things up (#6820) do not activate nested dropdowns together (#6830) Clearly select single specialization with enum dispatch pattern (#6819) Prevent incorrect application of list widget on incompatible expressions (#6771) Update GraalVM to 22.3.1 JDK17 (#6750) Import/export syntax error have more specific messages (#6808) ...
Pull Request Description
Follow-up of #6711
Closes #6838
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.